package com.foreveross.crawl.workers;

import org.apache.log4j.Logger;
import org.quartz.InterruptableJob;

import com.foreveross.crawl.application.plane.IPlaneInfoApplication;
import com.foreveross.crawl.application.source.IGrapSourceDataApplication;
import com.foreveross.crawl.application.task.ITaskOperateApplication;
import com.foreveross.crawl.common.application.IProxyChannelRelateApplication;
import com.foreveross.crawl.common.application.ITaskModelEntityApplication;
import com.foreveross.crawl.common.util.SpringHelper;
import com.foreveross.taskservice.common.application.crawlnode.ICrawlNodeBaseTaskApplication;

public abstract class AbstractTaskWorker implements InterruptableJob {
	
	public static Logger _log = Logger.getLogger(AbstractTaskWorker.class);
	
	protected IPlaneInfoApplication planeInfoService;
	
	protected IGrapSourceDataApplication grapSourceDataService;
	protected ICrawlNodeBaseTaskApplication iCrawlNodeBaseTaskApplication;
	protected ITaskOperateApplication iTaskOperateApplication;
	protected ITaskModelEntityApplication iTaskModelEntityApplication;
	protected IProxyChannelRelateApplication iProxyChannelRelateApplication;
	
	/**
	 * 实例化的时候，同时实例化所有的计数器
	 */
	public AbstractTaskWorker(){
		planeInfoService = (IPlaneInfoApplication)SpringHelper.getBean(IPlaneInfoApplication.class);
		grapSourceDataService = (IGrapSourceDataApplication)SpringHelper.getBean(IGrapSourceDataApplication.class); 
		iCrawlNodeBaseTaskApplication=(ICrawlNodeBaseTaskApplication) SpringHelper.getBean("crawlNodeTaskMQApplicationImpl");
		iTaskOperateApplication = (ITaskOperateApplication)SpringHelper.getBean(ITaskOperateApplication.class);
		iTaskModelEntityApplication = (ITaskModelEntityApplication)SpringHelper.getBean(ITaskModelEntityApplication.class);
		iProxyChannelRelateApplication = (IProxyChannelRelateApplication)SpringHelper.getBean(IProxyChannelRelateApplication.class);
	}

}
